/**
 * 
 */
package com.ailk.evaluation.common;

import javax.servlet.ServletContextEvent;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.anhorn.webshare.common.ctx.SpringContext;


/**
 * 
 *
 */
public class AppContextListener extends ContextLoaderListener{

	@Override
	public void contextDestroyed(ServletContextEvent event) {
		super.contextDestroyed(event);		
	}

	@Override
	public void contextInitialized(ServletContextEvent event) {
		super.contextInitialized(event);
		
		ApplicationContext ctx  = WebApplicationContextUtils
		.getRequiredWebApplicationContext(event.getServletContext());
		
		SpringContext springContext = SpringContext.getInstance();
		springContext.setSpringApplication(ctx);
		
		/*String path = event.getServletContext().getRealPath("/");
		JsWriter jswriter = new JsWriter(ctx);
		jswriter.writeAreaJs(path+"/"+"static","area.js");*/
		
	}
}
